function fitting = FitMagnetometerBandwidth(obj, swprData, varargin)
    p=inputParser;    p.KeepUnmatched = true;
    p.addParameter('signal_amplitude', 0.01, @(x) x>0 && x < 0.1);
    p.addParameter('f129', 250.0, @(x) isnumeric(x) && x>0);
    p.addParameter('f131', 75.0, @(x) isnumeric(x) && x>0);
    p.addParameter('fRange', 40, @(x) isnumeric(x) && x>0);
    p.parse(varargin{:});
    
    amp = p.Results.signal_amplitude;
    f129 = p.Results.f129;
    f131 = p.Results.f131;
    fRange = p.Results.fRange;
    
    maxAmp = obj.SystemInfo.WorkingPoint.slopeX*amp*obj.SystemInfo.WorkingPoint.exportScaleAC/sqrt(2);    
    data1 = swprData.getNodeData(1); fList = data1.x; dataR = data1.y;
    [xData, yData] = prepareCurveData(fList, dataR);
    
    excludeIndex = find( (f131-fRange<xData & xData<f131+fRange) | (f129-fRange<xData & xData<f129+fRange));
    excludedPoints = excludedata( xData, yData, 'Indices', excludeIndex);
    ft = fittype('a*g/sqrt(x^2+g*g)+c', 'independent', 'x', 'dependent', 'y' );
    opts = fitoptions( 'Method', 'NonlinearLeastSquares' );
    opts.Display = 'Off';
    opts.StartPoint = [maxAmp, min(yData), 20];
    opts.Exclude = excludedPoints;
    
    [fittingR.result, fittingR.gof] = fit( xData, yData, ft, opts );
    fittingR.dcValue = maxAmp;
    fittingR.amplitude = fittingR.result.a;
    fittingR.background = fittingR.result.c;
    fittingR.bandwidth = fittingR.result.g;
    fittingR.exclude = [f129, f131];
    fittingR.excludeRange = fRange;
    fittingR.gain129 = fittingR.result(f129)/amp;
    fittingR.gain131 = fittingR.result(f131)/amp;
    
    %%
    data2 = swprData.getNodeData(2); fList=data2.x; dataTheta=data2.y;
    [xData, yData] = prepareCurveData(fList, dataTheta);
    excludedPoints = excludedata( xData, yData, 'Indices', excludeIndex);
    ft = fittype( 'smoothingspline' );
    opts = fitoptions( 'Method', 'SmoothingSpline' );
    opts.Exclude = excludedPoints;
    [fittingTheta.result, fittingTheta.gof] = fit( xData, yData, ft, opts );
    fittingTheta.exclude = [f129, f131];
    fittingTheta.excludeRange = fRange;
    fittingTheta.phase129 =fittingTheta.result(f129)/pi*180;
    fittingTheta.phase131 =fittingTheta.result(f131)/pi*180;
    
    %%
    fitting.R = fittingR;
    fitting.Theta = fittingTheta;
end